
document.write('<script type="text/javascript" charset="utf-8" src="/scripts/ueditor/ueditor.config.js"></script>' +
    '<script type="text/javascript" charset="utf-8" src="/scripts/ueditor/ueditor.all.min.js"> </script>' +
    '<script type="text/javascript" charset="utf-8" src="/scripts/ueditor/lang/zh-cn/zh-cn.js"> </script>');
// 百度富文本框
Vue.component('baidu-editor', {
    template: `<div ref="baidu_editor" :style="{ width: width + 'px', height: height + 'px'}"></div>`,
    props: {
        datas: {
            type: String,
            default: ""
        },
        width: {
            type: Number,
            default: 800
        },
        height: {
            type: Number,
            default: 400
        },
        options: {
            type: Object,
            default: {}
        }
    },
    data() {
        return {
            UE: null
        }
    },
    methods: {
        initUE() {
            this.UE = UE.getEditor(this.$refs.baidu_editor, this.options);
            this.setContent();
        },
        setContent() {
            var _this = this;
            _this.UE.ready(function () {
                _this.UE.setContent(_this.datas);
            });
        },
        getContent() {
            return this.UE.getContent();
        }
    },
    mounted() {
        this.initUE();
    }
})